package com.hmsg.health.controller.admin;


import com.hmsg.health.bean.domain.AdminSystemDo;
import com.hmsg.health.bean.domain.TaskTypeDo;
import com.hmsg.health.bean.enums.StatusCode;
import com.hmsg.health.bean.vo.AdminSystemReqVo;
import com.hmsg.health.bean.vo.TaskFirstReqVo;
import com.hmsg.health.dao.AdminSystemDao;
import com.hmsg.health.param.ResponseResult;
import com.hmsg.health.security.IgnoreSecurity;
import com.hmsg.health.security.OpenApi;
import com.hmsg.health.service.aes.SecurityData;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

@Api(value = "运营系统提现开关相关", tags = { "运营系统提现开关相关" })
@Slf4j
@Controller
@RequestMapping("/system")
public class AdminSystemController {
    @Autowired
    private AdminSystemDao adminSystemDao;

    @PostMapping("/editWithdrwIsOpen")
    @ApiOperation(value="编辑提现开关", notes="编辑任务一级" ,httpMethod="POST")
    @ResponseBody
    @IgnoreSecurity
    @OpenApi
    public ResponseResult<Object> editFirst(@ApiParam(name = "编辑任务一级", value = "传入json格式", required = true)
                                            @RequestBody @Validated AdminSystemReqVo vo) {

        AdminSystemReqVo adminSystemReqVo=new AdminSystemReqVo();
        adminSystemReqVo.setId(vo.getId());
        adminSystemReqVo.setIsOpen(vo.getIsOpen());
        adminSystemDao.update(adminSystemReqVo);
        return new ResponseResult<Object>(StatusCode.SYSTEM_SUCCESS, null);
    }


    //查询
    @GetMapping("/queryWithdrwIsOpen")
    @ApiOperation(value="查询是否开关", notes="查询是否开关" ,httpMethod="GET")
    @ResponseBody
    @IgnoreSecurity
    @OpenApi
    public ResponseResult<Object> queryWithdrwIsOpen() {
        AdminSystemDo adminSystemDo=adminSystemDao.find();
        return new ResponseResult<Object>(StatusCode.SYSTEM_SUCCESS, adminSystemDo);
    }


}
